import axios from "@/utils/axios";

export default {
    namespaced: true,
    state: {
        rightList: [

        ],
        storeMap: {

        },
        storeTreeList: {

        }
    },
    getters: {

    },
    mutations: {

    },
    actions: {
        async rightList({state}) {
            const rightList = await axios.get('/right-list');
            if (rightList.success) {
                state.rightList = rightList.data.map(item => {
                    return {text: item.name, value: item.key}
                });
            }
        },
        async storeMap({state}) {
            const storeList = await axios.get('/store-map');
            if (storeList.success)  {
                const {storeMap, storeTreeList} = storeList.data;
                state.storeMap = storeMap;
                state.storeTreeList = storeTreeList;
            }
        }
    }
}
